package com.ktjiaoyu.t313.service;

import com.ktjiaoyu.t313.dao.SysUserDao;
import com.ktjiaoyu.t313.pojo.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements  UserService {

    @Autowired
    private SysUserDao sysUserDao;

    @Override
    public SysUser login(String userName, String password) {

        return sysUserDao.findUserByNameAndPassword(userName,password);
    }

    @Override
    public List<SysUser> getUserList(String queryRealName, Integer queryRoleId, int currentPageNo, int pageSize) {

        return sysUserDao.selectList(queryRealName,queryRoleId,currentPageNo,pageSize);
    }

    @Override
    public int getUserCount(String realName, Integer roleId) {

        return sysUserDao.selectCount(realName,roleId);
    }

    @Override
    public int addUser(SysUser sysUser) {

        return sysUserDao.addUser(sysUser);
    }

    @Override
    public SysUser selectByAccount(String account) throws Exception {

        return sysUserDao.selectByAccount(account);
    }

    @Override
    public SysUser getUserById(Integer id) throws Exception {

        return sysUserDao.getUserById(id);
    }
}
